#ifndef _exception_h_
#define _exception_h_

// exception.h
//
//  Exception class for SIMPLE classes

#include <exception>
#include <stdexcept>

#include <string>

namespace simple{
    //
    // Exception
    //
    // The exception handling classes from the STL do what we want,
    // so this is nothing more than a base class for any of our 
    // derived exceptions. I have changed the constructor to take a
    // std::string object, but this gets converted before calling
    // std::exception.

    class Exception : public std::exception
    {
    public:
        Exception (std::string name) throw()
            : std::exception (), _name (name) {}

        virtual ~Exception () throw () {}

        virtual const char* what () const throw()
        { return _name.c_str();}

    protected:
        std::string _name;
    };




    //
    // Derived Exceptions
    //

    class BoundsException : public Exception
    {
    public:
        BoundsException (std::string name="")
            : Exception ("BoundsException: " + name) {}
    };

    class UnsupportedException : public Exception
    {
    public:
        UnsupportedException (std::string name="") 
            : Exception ("UnsupportedException: " + name) {}
    };

}

#endif // _exception_h_
